using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
using System.Data;

using PlugNT.Safe;
using PlugNT.Cms.Custom;
using PlugNT.Database;
using PlugNT.Database.Common.Simple;
using PlugNT.App.Shop.Model;

namespace PlugNT.App.Shop.BLL
{
    public class Cart 
    {

        private static readonly PlugNT.App.Shop.DAL.Cart dal = new PlugNT.App.Shop.DAL.Cart();



        public bool Add(CartItemInfo model)
        {
            return dal.Add(model);
        }

        public bool Update(CartItemInfo model)
        {
            return dal.Update(model);
        }

        public bool Delete(int id)
        {
            return dal.Delete(id);
        }

        public bool DeleteByUserId(int userId)
        {
            return PlugNT.App.Shop.DAL.Cart.DeleteByUserId(userId);
        }

        public bool DeleteByDays(int days)
        {
            return PlugNT.App.Shop.DAL.Cart.DeleteByDays(days);
        }


        public int GetCount(int sysModelId, int userId)
        {
            return dal.GetCount(sysModelId, " and user_id=" + userId);
        }

        public int GetQuantityTotal(int sysModelId, int userId)
        {
            return dal.GetTotal(sysModelId, "quantity", " and user_id=" + userId);
        }

        public int GetMoneyTotal(int sysModelId, int userId)
        {
            return dal.GetTotal(sysModelId, "money", " and user_id=" + userId);
        }

        public DataTable GetList(int sysModelId, int userId, string andWhere)
        {
            return PlugNT.App.Shop.DAL.Cart.GetList(sysModelId, " and user_id=" + userId + andWhere);
        }

        public CartItemInfo GetCartItemInfo(int id)
        {
            return dal.GetCartItemInfo(id);
        }

        public CartItemInfo GetCartItemInfo(int sysModelId, int userId, int goodsId)
        {
            return dal.GetCartItemInfo(sysModelId, userId, goodsId);
        }

    }
}

